package hbt;

import org.hibernate.SessionFactory;

import entities.*;
import org.hibernate.cfg.AnnotationConfiguration;



public class HibernateUtil
{
	private static final SessionFactory sessionFactory;
	static
	{
		try
		{
			AnnotationConfiguration config = new AnnotationConfiguration();
			config.addAnnotatedClass(ProveedorBean.class);
			config.addAnnotatedClass(MaterialBean.class);
			config.addAnnotatedClass(PrecioBean.class);
			config.addAnnotatedClass(OrdenDeCompraBean.class);			
			config.addAnnotatedClass(ItemOCBean.class);			
			sessionFactory = config.buildSessionFactory();
		}
		catch (Throwable ex)
		{
			System.err.println("Initial SessionFactory creation failed." + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory()
	{
		return sessionFactory;

	}
}










